﻿using PeaceBlogData.Tables;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Web;

namespace PeaceBlog
{
    public class WidgetsHelper : IDisposable
    {
        private PeaceBlogData.PeaceBlogEntity Context;

        public WidgetsHelper()
        {
            Context = new PeaceBlogData.PeaceBlogEntity();
        }

        ~WidgetsHelper()
        {
            Dispose();
        }

        public void Dispose()
        {
            Context.Dispose();
            GC.SuppressFinalize(this);
        }

        public List<Categories> GetCategories()
        {
            return Context.GetAllCategories();
        }

        public List<Posts> RecentPosts(int PostCount = 5)
        {
            return Context.GetRecentPosts(PostCount);
        }

        public List<Tags> GetTags()
        {
            return Context.GetAllTags();
        }
    }
}